
 // const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin')
 const { ModuleFederationPlugin } = require('webpack').container
 const dependencies = require('../package.json').dependencies
 export function chainWebpack(config, { env, webpack, createCSSRule }) {
  config.merge({
    output: {
      publicPath: 'auto',
    },
  })
  config.plugin('moduleFederation').use(ModuleFederationPlugin, [
    {
      name: 'app_cdn',
      library: { type: 'var', name: 'app_cdn' },
      filename: 'remoteEntry.js',
      exposes: {
        './Demo': './src/Demo.jsx',
      },
      // remotes: {
      //   app_project: 'app_project@http://localhost:3002/remoteEntry.js',
      // },
      // shared: {
      //   react: {
      //     singleton: true,
      //     eager: true,
      //     requiredVersion: dependencies.react,
      //   },
      //   'react-dom': {
      //     singleton: true,
      //     eager: true,
      //     requiredVersion: dependencies['react-dom'],
      //   }
      // },

      //shared: ['react', 'react-dom', 'react-router-dom', 'umi'],
    },
  ])
 }
